import { wxLogin } from "../../api/login";

Page({
  async handleOne(event) {
    console.log(event);

    // 1. 获取 code
    const { code } = await wx.login();

    // 2. 获取 加密的信息
    // const { encryptedData, iv } = event.detail;
    const { encryptedData, iv } = await wx.getUserInfo();

    // 3. 调用 手机号码快捷登录接口
    const resp = await wxLogin(code, encryptedData, iv);
    console.log("resp", resp);
  },

  handleTwo() {
    wx.requestSubscribeMessage({
      // 模板ID集合
      tmplIds: [
        "E0ymnd9UQQxpMVHMYofHMvW6CZF04g76PbWTRZqQEik",
        "X8m17h2BWcvrl_oyvu0XqKQPeQXNhOadknsVyJN12qA",
      ],
    });
  },
});
